package com.eypg.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.eypg.dao.BaseDAO;
import com.eypg.pojo.Producttype;
import com.eypg.service.ProductTypeService;
@Service
public class ProductTypeServiceImpl implements ProductTypeService{
	@Autowired
	@Qualifier("baseDao")
	BaseDAO baseDao;

	public void addProductType(Producttype productType) {
		baseDao.saveOrUpdate(productType);
		
	}

	public void delProductType(int id) {
		baseDao.delById(Producttype.class, id);
		
	}

	public void updateProductType(String hql) {
		baseDao.update(hql);
	}

	@SuppressWarnings("unchecked")
	public List<Producttype> queryProductType(String hql) {
		return (List<Producttype>)baseDao.query(hql);
	}

	@SuppressWarnings("unchecked")
	public List<Producttype> queryAllProductType() {
		String hql = " from Producttype p where 1=1";
		return (List<Producttype>)baseDao.query(hql);
	}
}
